﻿<!--
<copyright file="OfficeColorPicker.xaml" company="Microsoft">
//  Copyright (c) Microsoft Corporation.  All rights reserved.
</copyright>
<summary>
// WPF color picker component which resembles office 2007 color picker drop down.
</summary>
-->
    <ComboBox
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
    xmlns:local="clr-namespace:BioExcel.Visualizations.Common"
	xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
	x:Class="BioExcel.Visualizations.Common.OfficeColorPicker"
	d:DesignWidth="205" d:DesignHeight="30"
	x:Name="colorCombo" Style="{DynamicResource ComboBoxHead}" ItemContainerStyle="{DynamicResource ColorDropDown}">
        
    <ComboBox.Resources>
        <Style x:Key="colorBox" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border Name="borderBox" Width="13" Height="13" Background="{TemplateBinding Background}" BorderBrush="Gainsboro" BorderThickness="{TemplateBinding BorderThickness}">
                            <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent" BorderBrush="Transparent" BorderThickness="1"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter TargetName="borderBox" Property="BorderBrush" Value="#FFFCBB75" />
                                <Setter TargetName="borderBox" Property="BorderThickness" Value="2" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="menuItemButton" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border Name="buttonBack" Background="White" Padding="5,2,2,2" BorderBrush="Gray" BorderThickness="0,1,0,1">
                            <TextBlock Text="{TemplateBinding Content}" VerticalAlignment="Center" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter TargetName="buttonBack" Property="Background" Value="#FFFFF0C1" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ComboBoxFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="4,4,21,4" SnapsToDevicePixels="true"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
            <GradientStop Color="#F3F3F3" Offset="0"/>
            <GradientStop Color="#EBEBEB" Offset="0.5"/>
            <GradientStop Color="#DDDDDD" Offset="0.5"/>
            <GradientStop Color="#CDCDCD" Offset="1"/>
        </LinearGradientBrush>
        <SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
        <Geometry x:Key="DownArrowGeometry">M 0 0 L 3.5 4 L 7 0 Z</Geometry>
        <Style x:Key="ComboBoxReadonlyToggleButton" TargetType="{x:Type ToggleButton}">
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="ClickMode" Value="Press"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToggleButton}">
                        <Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}">
                            <Grid HorizontalAlignment="Right" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
                                <Path x:Name="Arrow" Fill="Black" HorizontalAlignment="Center" Margin="3,1,0,0" VerticalAlignment="Center" Data="{StaticResource DownArrowGeometry}"/>
                            </Grid>
                        </Microsoft_Windows_Themes:ButtonChrome>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="true">
                                <Setter Property="RenderPressed" TargetName="Chrome" Value="true"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Fill" TargetName="Arrow" Value="#AFAFAF"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <LinearGradientBrush x:Key="TextBoxBorder" EndPoint="0,20" StartPoint="0,0" MappingMode="Absolute">
            <GradientStop Color="#ABADB3" Offset="0.05"/>
            <GradientStop Color="#E2E3EA" Offset="0.07"/>
            <GradientStop Color="#E3E9EF" Offset="1"/>
        </LinearGradientBrush>
        <Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="AllowDrop" Value="true"/>
            <Setter Property="MinWidth" Value="0"/>
            <Setter Property="MinHeight" Value="0"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBox}">
                        <ScrollViewer x:Name="PART_ContentHost" Background="Transparent" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="ClickMode" Value="Press"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToggleButton}">
                        <Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}" RoundCorners="false">
                            <Path x:Name="Arrow" Fill="Black" HorizontalAlignment="Center" Margin="0,1,0,0" VerticalAlignment="Center" Data="{StaticResource DownArrowGeometry}"/>
                        </Microsoft_Windows_Themes:ButtonChrome>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="true">
                                <Setter Property="RenderPressed" TargetName="Chrome" Value="true"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Fill" TargetName="Arrow" Value="#AFAFAF"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
            <Grid x:Name="Placement" SnapsToDevicePixels="true">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Popup x:Name="PART_Popup" AllowsTransparency="true" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Grid.ColumnSpan="2">
                    <Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=Placement}" Color="Transparent">
                        <Border x:Name="DropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
                            <ScrollViewer>
                                <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
                            </ScrollViewer>
                        </Border>
                    </Microsoft_Windows_Themes:SystemDropShadowChrome>
                </Popup>
                <Microsoft_Windows_Themes:ListBoxChrome x:Name="Border" Grid.ColumnSpan="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" RenderFocused="{TemplateBinding IsKeyboardFocusWithin}" RenderMouseOver="{TemplateBinding IsMouseOver}"/>
                <TextBox x:Name="PART_EditableTextBox" Margin="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"/>
                <ToggleButton Style="{StaticResource ComboBoxToggleButton}" Grid.Column="1" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsKeyboardFocusWithin" Value="true">
                    <Setter Property="Foreground" Value="Black"/>
                </Trigger>
                <Trigger Property="IsDropDownOpen" Value="true">
                    <Setter Property="RenderFocused" TargetName="Border" Value="true"/>
                </Trigger>
                <Trigger Property="HasItems" Value="false">
                    <Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
                </Trigger>
                <Trigger Property="IsEnabled" Value="false">
                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                    <Setter Property="Background" Value="#FFF4F4F4"/>
                </Trigger>
                <Trigger Property="IsGrouping" Value="true">
                    <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                </Trigger>
                <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
                    <Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
                    <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <Style x:Key="ComboBoxHead" TargetType="{x:Type ComboBox}">
            <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
            <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
            <Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
            <Setter Property="Padding" Value="4,3"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ComboBox}">
                        <Grid x:Name="MainGrid" SnapsToDevicePixels="true">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="0.762*"/>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
                            </Grid.ColumnDefinitions>
                            <Popup x:Name="PART_Popup" Margin="1" AllowsTransparency="true" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Grid.ColumnSpan="3" d:LayoutOverrides="GridBox">
                                <Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=MainGrid}" Color="Transparent">
                                    <Border x:Name="DropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
                                        <ScrollViewer CanContentScroll="true">
                                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
                                        </ScrollViewer>
                                    </Border>
                                </Microsoft_Windows_Themes:SystemDropShadowChrome>
                            </Popup>
                            <ToggleButton Style="{StaticResource ComboBoxReadonlyToggleButton}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" Grid.ColumnSpan="3" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" d:LayoutOverrides="GridBox"/>

                            <TextBlock Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="8,2,2,2" Focusable="False" />
                            <Border x:Name="selectedColor" HorizontalAlignment="Stretch" Margin="2" Grid.Column="1" BorderBrush="#FF707070" BorderThickness="1" CornerRadius="2" Background="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}}" Width="25"/>

                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
                                <Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
                                <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
                            </Trigger>
                            <Trigger Property="HasItems" Value="false">
                                <Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                <Setter Property="Background" Value="#FFF4F4F4"/>
                            </Trigger>
                            <Trigger Property="IsGrouping" Value="true">
                                <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsEditable" Value="true">
                    <Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder}"/>
                    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                    <Setter Property="IsTabStop" Value="false"/>
                    <Setter Property="Padding" Value="3"/>
                    <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="ColorDropDown" TargetType="{x:Type ComboBoxItem}">
            <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Padding" Value="3,0,3,0"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                        <Border x:Name="Bd" SnapsToDevicePixels="true" Background="White" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">

                                <Border Background="AliceBlue" Padding="10,0,0,0" BorderThickness="0,0,0,1" BorderBrush="Gray">
                                    <TextBlock Text="Theme Colors" FontSize="10.667" Foreground="#FF173284" FontWeight="Bold" />
                                </Border>
                                <StackPanel Orientation="Horizontal">
                                    <StackPanel Orientation="Vertical" Margin="3,3,2,3">
                                        <Button Style="{StaticResource colorBox}" Margin="0,0,0,5" Background="White" BorderThickness="1" Click="OnColorSelect" />
                                        <Button Style="{StaticResource colorBox}" Background="#FFF2F2F2" BorderThickness="1,1,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFD8D8D8" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFBFBFBF" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFA5A5A5" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF7F7F7F" BorderThickness="1,0,1,1" Click="OnColorSelect"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Vertical" Margin="2,3,2,3">
                                        <Button Style="{StaticResource colorBox}" Margin="0,0,0,5" Background="Black" BorderThickness="1" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF7F7F7F" BorderThickness="1,1,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF595959" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF3F3F3F" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF262626" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF0C0C0C" BorderThickness="1,0,1,1" Click="OnColorSelect"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Vertical" Margin="2,3,2,3">
                                        <Button Style="{StaticResource colorBox}" Margin="0,0,0,5" Background="#FFEEECE1" BorderThickness="1" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFDDD9C3" BorderThickness="1,1,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFC4BD97" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF938953" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF494429" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF1D1B10" BorderThickness="1,0,1,1" Click="OnColorSelect"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Vertical" Margin="2,3,2,3">
                                        <Button Style="{StaticResource colorBox}" Margin="0,0,0,5" Background="#FF1F497D" BorderThickness="1" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFC6D9F0" BorderThickness="1,1,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF8DB3E2" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF548DD4" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF17365D" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF0F243E" BorderThickness="1,0,1,1" Click="OnColorSelect"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Vertical" Margin="2,3,2,3">
                                        <Button Style="{StaticResource colorBox}" Margin="0,0,0,5" Background="#FF4F81BD" BorderThickness="1" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFDBE5F1" BorderThickness="1,1,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFB8CCE4" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF95B3D7" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF366092" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF244061" BorderThickness="1,0,1,1" Click="OnColorSelect"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Vertical" Margin="2,3,2,3">
                                        <Button Style="{StaticResource colorBox}" Margin="0,0,0,5" Background="#FFC0504D" BorderThickness="1"  Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFF2DCDB" BorderThickness="1,1,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFE5B9B7" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFD99694" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF953734" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF632423" BorderThickness="1,0,1,1" Click="OnColorSelect"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Vertical" Margin="2,3,2,3">
                                        <Button Style="{StaticResource colorBox}" Margin="0,0,0,5" Background="#FF9BBB59" BorderThickness="1" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFEBF1DD" BorderThickness="1,1,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFD7E3BC" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFC3D69B" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF76923C" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF4F6128" BorderThickness="1,0,1,1" Click="OnColorSelect"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Vertical" Margin="2,3,2,3">
                                        <Button Style="{StaticResource colorBox}" Margin="0,0,0,5" Background="#FF8064A2" BorderThickness="1" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFE5E0EC" BorderThickness="1,1,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFCCC1D9" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFB2A2C7" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF5F497A" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF3F3151" BorderThickness="1,0,1,1" Click="OnColorSelect"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Vertical" Margin="2,3,2,3">
                                        <Button Style="{StaticResource colorBox}" Margin="0,0,0,5" Background="#FF4BACC6" BorderThickness="1" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFDBEEF3" BorderThickness="1,1,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFB7DDE8" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF92CDDC" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF31859B" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF205867" BorderThickness="1,0,1,1" Click="OnColorSelect"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Vertical" Margin="2,3,3,3">
                                        <Button Style="{StaticResource colorBox}" Margin="0,0,0,5" Background="#FFF79646" BorderThickness="1" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFFDEADA" BorderThickness="1,1,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFFBD5B5" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFFAC08F" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FFE36C09" BorderThickness="1,0,1,0" Click="OnColorSelect"/>
                                        <Button Style="{StaticResource colorBox}" Background="#FF974806" BorderThickness="1,0,1,1" Click="OnColorSelect"/>
                                    </StackPanel>
                                </StackPanel>

                                <Border Background="AliceBlue" Padding="10,0,0,0" BorderThickness="0,0,0,1" BorderBrush="Gray">
                                    <TextBlock Text="Standard Colors" FontSize="10.667" Foreground="#FF173284" FontWeight="Bold" />
                                </Border>
                                <StackPanel Orientation="Horizontal">
                                    <Button Style="{StaticResource colorBox}" Background="#FFC00000" Margin="3,3,2,3" Click="OnColorSelect"/>
                                    <Button Style="{StaticResource colorBox}" Background="Red" Margin="2,3,2,3" Click="OnColorSelect"/>
                                    <Button Style="{StaticResource colorBox}" Background="#FFFFC000" Margin="2,3,2,3" Click="OnColorSelect"/>
                                    <Button Style="{StaticResource colorBox}" Background="Yellow" Margin="2,3,2,3" Click="OnColorSelect"/>
                                    <Button Style="{StaticResource colorBox}" Background="#FF92D050" Margin="2,3,2,3" Click="OnColorSelect"/>
                                    <Button Style="{StaticResource colorBox}" Background="#FF00B050" Margin="2,3,2,3" Click="OnColorSelect"/>
                                    <Button Style="{StaticResource colorBox}" Background="#FF00B0F0" Margin="2,3,2,3" Click="OnColorSelect"/>
                                    <Button Style="{StaticResource colorBox}" Background="#FF0070C0" Margin="2,3,2,3" Click="OnColorSelect"/>
                                    <Button Style="{StaticResource colorBox}" Background="#FF002060" Margin="2,3,2,3" Click="OnColorSelect"/>
                                    <Button Style="{StaticResource colorBox}" Background="#FF7030A0" Margin="2,3,2,3" Click="OnColorSelect"/>
                                </StackPanel>

                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="25" />
                                        <RowDefinition Height="25" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="25" />
                                        <ColumnDefinition Width="1*" />
                                    </Grid.ColumnDefinitions>

                                    <Border Background="#FFE1ECEC" BorderBrush="Gray" BorderThickness="0,1,1,0">
                                        <Rectangle Fill="White" Stroke="Gray" Width="15" Height="15"/>
                                    </Border>
                                    <Button Style="{StaticResource menuItemButton}" Content="No Fill" Grid.Column="1" Click="OnClearColor" />

                                    <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,1,1,0">
                                        <Canvas Background="#FFE1ECEC">
                                            <Ellipse Fill="#FF920000" Stroke="#18000000" Width="8" Height="8" Canvas.Left="3.25" Canvas.Top="3.5"/>
                                            <Ellipse Fill="#FF1562D0" Stroke="#18000000" Width="8" Height="8" Canvas.Left="11.75" Canvas.Top="5.25"/>
                                            <Ellipse Fill="#FF01780E" Stroke="#18000000" Width="8" Height="8" Canvas.Left="8" Canvas.Top="13"/>
                                        </Canvas>
                                    </Border>
                                    <Button Style="{StaticResource menuItemButton}" Content="More Colors" Grid.Column="1" Grid.Row="1" Click="OnShowColorDialog" />
                                </Grid>
                            </StackPanel>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </ComboBox.Resources>
</ComboBox>